(self.webpackChunkmp_webgl = self.webpackChunkmp_webgl || []).push([
  [383],
  {
    61501: (e, t, n) => {
      "use strict";
      n.r(t), n.d(t, { default: () => o });
      var a = n(66219),
        l = n(24930),
        i = n(2388),
        r = n(41659),
        s = n(86980);
      const o = async function (e) {
        const t = await e.getModule(l.default),
          n = t.addPanel(a.s.TITLE, a.s.HOTKEYS, { width: 350 });
        await t.loadPromise.then(() => {
          const a = "meshtextures";
          [
            {
              panel: n,
              header: a,
              setting: "textureStreamPause",
              initialValue: () => i.ZP.debugPauseTexStream,
              onChange: (e) => {
                i.ZP.debugPauseTexStream = e;
              },
              urlParam: !0,
            },
            {
              panel: n,
              header: a,
              setting: "textureStreamRaycastHits",
              initialValue: () => i.ZP.debugLOD,
              onChange: (e) => {
                (i.ZP.debugLOD = e),
                  e ||
                    s.M.forEach((e) => {
                      e.parent && e.parent.remove(e);
                    });
              },
              urlParam: !0,
            },
            {
              panel: n,
              header: a,
              setting: "debugRTTQuality",
              initialValue: () => i.ZP.debugRttQuality,
              onChange: (t) => {
                (i.ZP.debugRttQuality = t),
                  t ||
                    e.commandBinder.issueCommand(
                      new r.u({ color: null }, { style: r.u.selectBy.all })
                    );
              },
              urlParam: !0,
            },
            {
              panel: n,
              header: a,
              setting: "debugRTTScores",
              initialValue: () => i.ZP.debugRttScores,
              onChange: (t) => {
                (i.ZP.debugRttScores = t),
                  t ||
                    e.commandBinder.issueCommand(
                      new r.u({ color: null }, { style: r.u.selectBy.all })
                    );
              },
              urlParam: !0,
            },
          ].forEach((e) => t.registerMenuEntry(e));
        });
      };
    },
    25492: (e, t, n) => {
      "use strict";
      n.r(t), n.d(t, { default: () => C, tiledMeshDebugMenu: () => w });
      var a = n(88512),
        l = n(24930),
        i = n(96909),
        r = n(10757),
        s = n(55356),
        o = n(2212);
      var u = n(81812),
        d = n(66219),
        c = n(59855),
        g = n(2388),
        h = n(84303);
      const m = new a.Z("tiled-mesh");
      let p,
        y = null;
      function T(e, t, n) {
        y ||
          ((y = document.createElement("div")),
          (y.style.color = "#FFFFFF"),
          (y.style.fontFamily = "Roboto"),
          (y.style.fontWeight = "300"),
          (y.style.fontSize = "12px"),
          (y.style.position = "absolute"),
          (y.style.top = "50px"),
          (y.style.width = "500px"),
          (y.style.pointerEvents = "none"),
          (y.style.whiteSpace = "pre"),
          (y.style.zIndex = "99999"),
          (y.style.textShadow =
            "0 0 1px black, 0 0 1px black, 0 0 1px black, 0 0 1px black"),
          document.body.appendChild(y));
        let a = c.t.statsTiles
          ? (function (e, t) {
              const n = e.tilesRenderer,
                a = n.visibleTiles,
                l = {};
              a.forEach((e) => {
                var t;
                const n = `lod${
                    null === (t = e.extras) || void 0 === t ? void 0 : t.level
                  }`,
                  a = l[n] || 0;
                l[n] = a + 1;
              });
              const i = t.info,
                r = n.stats,
                {
                  active: s,
                  downloading: o,
                  inFrustum: u,
                  parsing: d,
                  used: c,
                  visible: g,
                } = r;
              return `\nthree:\n    drawCalls: ${
                i.render.calls
              }\n    geometries: ${i.memory.geometries}\n    textures: ${
                i.memory.textures
              }\n    triangles: ${
                i.render.triangles
              }\ntiles:\n    tiles in frustum: ${u}\n    visible: ${g}\n      lod0 tiles: ${
                l.lod0 || 0
              }\n      lod1 tiles: ${l.lod1 || 0}\n      lod2 tiles: ${
                l.lod2 || 0
              }\n      lod3 tiles: ${
                l.lod3 || 0
              }\n    downloading gltf: ${o}\n    parsing gltf: ${d}\n    active: ${s}\n    used: ${c}\n`;
            })(e, n)
          : "";
        (a += c.t.statsTextureStream
          ? (function (e) {
              const t =
                "downloaded:\n" +
                Object.keys(e.totalTextures)
                  .map((t) => `    ${t}: ${e.totalTextures[t]} `)
                  .join("\n") +
                "\n";
              return (
                `textureStreaming:\n    downloadingTiles: ${e.downloadingTiles} / ${e.totalTiles}\n    downloadingTextures: ${e.loadingTextures}\n` +
                t
              );
            })(t)
          : ""),
          (a += c.t.statsTextures
            ? (function (e) {
                if (p) return p;
                const t = e.tilesRenderer;
                if (!t) return "";
                const n = {};
                function a(e, t, n) {
                  const a = n.extras.maxTextureSize || 0,
                    l = e[t] || new Map();
                  (e[t] = l),
                    l.set(a, (l.get(a) || new Set()).add(n.extras.textureName));
                }
                return (
                  t.traverse(
                    (e) => {
                      if (
                        e.extras &&
                        void 0 !== e.extras.maxTextureSize &&
                        void 0 !== e.extras.level
                      ) {
                        const t = `lod${e.extras.level}`;
                        a(n, t, e);
                      }
                      return !1;
                    },
                    () => !1
                  ),
                  (p =
                    "texturesPerLod:\n" +
                    Object.keys(n)
                      .map(
                        (e) =>
                          `    ${e}:${[...n[e].entries()].map(
                            ([e, t]) => ` ${e}px: ${t.size}`
                          )} `
                      )
                      .join("\n")),
                  p
                );
              })(e)
            : ""),
          (y.textContent = a);
      }
      let x = !1;
      const b = (e) => {
        for (const t of e) t.setWireframe(x);
      };
      let E = !1;
      const f = (e, t) => {
          t.after(h.A.End).then(() => {
            e.forEach((e) => {
              const t = E ? (0, s.G1)(0.5, e.chunkIndex || 0) : null;
              e.setColorOverlay(t);
            });
          });
        },
        v = (e, t) => {
          t.after(h.A.End).then(() => {
            e.forEach((e) => {
              const t = E ? (0, s.G1)(0.5, e.lod || 0) : null;
              e.setColorOverlay(t);
            });
          });
        },
        S = (e, t) => {
          t.after(h.A.End).then(() => {
            e.forEach((e) => {
              const t = E ? (0, s.G1)(0.5, e.id || 0) : null;
              e.setColorOverlay(t);
            });
          });
        };
      async function w(e) {
        const t = await e.getModule(l.default),
          n = await e.getModuleBySymbol(i.y.INPUT),
          a = await e.getModuleBySymbol(i.y.WEBGL_RENDERER),
          s = a.getScene(),
          h = await e.getModuleBySymbol(i.y.MODEL_MESH),
          p = h.modelTextureLoader,
          y = h.modelMesh.tiledRenderer,
          w = t.tryGetProperty(g.iT, !1);
        w && c.t.statsTiles && setInterval(() => T(y, p, a.threeRenderer), 150);
        const C = t.addPanel(d.s.TITLE, d.s.HOTKEYS, { width: 350 }),
          O = { viz: "visualize", stats: "stats", tile: "tileset", log: "log" };
        let P;
        const M = y.notifyOnChunksLoaded(b),
          R = [
            {
              panel: C,
              header: O.viz,
              setting: "DebugTilesRenderer.colorMode",
              initialValue: () => "NONE",
              onChange: (e) => {
                m.warn("Render mode:", e);
                const t = u.c[e];
                (c.t.colorMode = t),
                  P ||
                    (P = (function () {
                      const e = new o.Group();
                      e.name = "Lights";
                      const t = new o.DirectionalLight(16777215, 0.5);
                      t.position.set(0, 10, 10);
                      const n = new o.DirectionalLight(16777215, 0.15);
                      n.position.set(-10, -10, 5), n.lookAt(0, 0, 0);
                      const a = new o.HemisphereLight(16777147, 526368, 0.5);
                      return e.add(t, n, a), e;
                    })()),
                  t !== u.c.NONE ? s.add(P) : s.remove(P);
              },
              options: Object.keys(u.c),
              urlParam: !0,
            },
            {
              panel: C,
              header: O.viz,
              setting: "wireframe",
              initialValue: () => !1,
              onChange: (e) => {
                (x = e), b([...y.container.chunks]), e ? M.renew() : M.cancel();
              },
              urlParam: !0,
            },
          ],
          L = (function (e, t, n, a) {
            const l = n.notifyOnChunksLoaded((e) => f(e, a)),
              i = n.notifyOnChunksLoaded((e) => v(e, a)),
              r = n.notifyOnChunksLoaded((e) => S(e, a));
            return [
              {
                panel: e,
                header: t.viz,
                setting: "colorizeByLod",
                initialValue: () => !1,
                onChange: (e) => {
                  (E = e),
                    v([...n.container.chunks], a),
                    e ? i.renew() : i.cancel();
                },
                urlParam: !0,
              },
              {
                panel: e,
                header: t.viz,
                setting: "colorizeByTile",
                initialValue: () => !1,
                onChange: (e) => {
                  (E = e),
                    f([...n.container.chunks], a),
                    e ? l.renew() : l.cancel();
                },
                urlParam: !0,
              },
              {
                panel: e,
                header: t.viz,
                setting: "colorizeByNode",
                initialValue: () => !1,
                onChange: (e) => {
                  (E = e),
                    S([...n.container.chunks], a),
                    e ? r.renew() : r.cancel();
                },
                urlParam: !0,
              },
            ];
          })(C, O, y, e),
          B = [
            {
              panel: C,
              header: O.stats,
              setting: "tileStatsOverlay",
              initialValue: () => c.t.statsTiles,
              onChange: (e) => {
                c.t.statsTiles = e;
              },
              urlParam: !0,
            },
            {
              panel: C,
              header: O.stats,
              setting: "textureStatsOverlay",
              initialValue: () => c.t.statsTextures,
              onChange: (e) => {
                c.t.statsTextures = e;
              },
              urlParam: !0,
            },
            {
              panel: C,
              header: O.stats,
              setting: "textureStreamingOverlay",
              initialValue: () => c.t.statsTextureStream,
              onChange: (e) => {
                c.t.statsTextureStream = e;
              },
              urlParam: !0,
            },
          ],
          D = [
            {
              panel: C,
              header: O.log,
              buttonName: "Log: App State",
              callback: () => {
                m.warn(h), m.warn(n), m.warn(s), m.warn(t);
              },
            },
          ];
        w &&
          (c.t.hideMenu ||
            (await (0, r.gw)(1e3).then(() => {
              t.getSettingsGui()
                .loadGuiPackage()
                .then(() => {
                  t.getSettingsGui().toggle(t.getMainPanelId()),
                    t.getSettingsGui().toggle(t.getMainPanelId());
                });
            })),
          await (0, r.gw)(16),
          R.forEach((e) => t.registerMenuEntry(e)),
          L.forEach((e) => t.registerMenuEntry(e)),
          await (0, r.gw)(16),
          (function (e, t) {
            return [
              {
                panel: e,
                header: t.tile,
                setting: "maxDepth",
                initialValue: () => c.t.maxDepth,
                onChange: (e) => {
                  c.t.maxDepth = e;
                },
                range: [0, 6],
                rangePrecision: 0,
                urlParam: !0,
              },
              {
                panel: e,
                header: t.tile,
                setting: "errorTarget",
                initialValue: () => c.t.errorTarget,
                onChange: (e) => {
                  c.t.errorTarget = e;
                },
                range: [0, 20],
                rangePrecision: 1,
                urlParam: !0,
              },
              {
                panel: e,
                header: t.tile,
                setting: "displayBoxBounds",
                initialValue: () => c.t.displayBoxBounds,
                onChange: (e) => {
                  c.t.displayBoxBounds = e;
                },
                urlParam: !0,
              },
              {
                panel: e,
                header: t.tile,
                setting: "displayActiveTiles",
                initialValue: () => c.t.displayActiveTiles,
                onChange: (e) => {
                  c.t.displayActiveTiles = e;
                },
                urlParam: !0,
              },
              {
                panel: e,
                header: t.tile,
                setting: "loadSiblings",
                initialValue: () => c.t.loadSiblings,
                onChange: (e) => {
                  c.t.loadSiblings = e;
                },
                urlParam: !0,
              },
              {
                panel: e,
                header: t.tile,
                setting: "autoDisableRendererCulling",
                initialValue: () => c.t.autoDisableRendererCulling,
                onChange: (e) => {
                  c.t.autoDisableRendererCulling = e;
                },
                urlParam: !0,
              },
              {
                panel: e,
                header: t.tile,
                setting: "stopAtEmptyTiles",
                initialValue: () => c.t.stopAtEmptyTiles,
                onChange: (e) => {
                  c.t.stopAtEmptyTiles = e;
                },
                urlParam: !0,
              },
              {
                panel: e,
                header: t.tile,
                setting: "disableTileUpdates",
                initialValue: () => c.t.disableTileUpdates,
                onChange: (e) => {
                  c.t.disableTileUpdates = e;
                },
                urlParam: !0,
              },
              {
                panel: e,
                header: t.tile,
                setting: "useOcclusionInfo",
                initialValue: () => c.t.useOcclusionInfo,
                onChange: (e) => {
                  c.t.useOcclusionInfo = e;
                },
                urlParam: !0,
              },
            ];
          })(C, O).forEach((e) => t.registerMenuEntry(e)),
          B.forEach((e) => t.registerMenuEntry(e)),
          D.forEach((e) => t.registerMenuButton(e)));
      }
      const C = w;
    },
    66219: (e, t, n) => {
      "use strict";
      n.d(t, { s: () => a });
      const a = { TITLE: "streamed-mesh (T)", HOTKEYS: [n(81507).R.T] };
    },
    41659: (e, t, n) => {
      "use strict";
      n.d(t, { u: () => SetMeshOverlayCommand });
      var a,
        l,
        i = n(17386);
      !(function (e) {
        (e.all = "all"),
          (e.byFloorId = "byFloorId"),
          (e.byRoomId = "byRoomId"),
          (e.byMeshGroup = "byMeshGroup"),
          (e.byMeshSubGroup = "byMeshSubGroup");
      })(a || (a = {})),
        (function (e) {
          (e.explicit = "explicit"), (e.random = "random");
        })(l || (l = {}));
      class SetMeshOverlayCommand extends i.m {
        constructor(e, t) {
          super(),
            (this.id = "SET_MESH_OVERLAY_COLOR"),
            (this.payload = {
              selectBy: (null == t ? void 0 : t.style) || a.all,
              colorStyle: (null == e ? void 0 : e.style) || l.explicit,
              color: (null == e ? void 0 : e.color) || null,
              alpha: (null == e ? void 0 : e.alpha) || 0.5,
              id: null == t ? void 0 : t.id,
              index: null == t ? void 0 : t.index,
            });
        }
      }
      (SetMeshOverlayCommand.selectBy = a),
        (SetMeshOverlayCommand.colorBy = l),
        (SetMeshOverlayCommand.COLOR_DIM = { x: 0, y: 0, z: 0, w: 0.3 });
    },
    59855: (e, t, n) => {
      "use strict";
      n.d(t, { t: () => i });
      var a = n(98828),
        l = n(81812);
      const i = {
        tileset: (0, a.h)("tileset", ""),
        hideMenu: "1" !== (0, a.h)("dmenu", "0"),
        debug: "1" === (0, a.h)("debugTiles", "0"),
        displayBoxBounds: !1,
        initialMaxDepth: 0,
        maxDepth: Number((0, a.h)("maxDepth", "6")),
        colorMode: l.c.NONE,
        loadSiblings: !0,
        displayActiveTiles: !0,
        autoDisableRendererCulling: !1,
        optimizeRaycast: !1,
        stopAtEmptyTiles: !0,
        statsTiles: !0,
        statsTextures: !1,
        statsTextureStream: !1,
        debugGeometricError: (0, a.h)("geometricError", "0.3,0.06,0.015,0.003"),
        errorTarget: Number((0, a.h)("errorTarget", 4)),
        disableTileUpdates: !1,
        useOcclusionInfo: !0,
        tileSightingTTL: 5e3,
      };
    },
    81812: (e, t, n) => {
      "use strict";
      n.d(t, { c: () => a });
      const a = {
        NONE: 0,
        SCREEN_ERROR: 1,
        GEOMETRIC_ERROR: 2,
        DISTANCE: 3,
        DEPTH: 4,
        RELATIVE_DEPTH: 5,
        IS_LEAF: 6,
        RANDOM_COLOR: 7,
        RANDOM_NODE_COLOR: 8,
      };
    },
    86980: (e, t, n) => {
      "use strict";
      n.d(t, { e: () => r, M: () => s });
      var a = n(2212);
      const l = [];
      let i = 0;
      const r = (e, t) => {
          if (0 === l.length)
            for (let e = 0; e < 100; e++) {
              const e = new a.Mesh(
                new a.SphereBufferGeometry(0.005),
                new a.MeshBasicMaterial()
              );
              l.push(e);
            }
          return (n) => {
            const a = l[i++ % l.length];
            a.position.copy(n.point),
              a.scale.set(n.distance, n.distance, n.distance),
              a.material.color.setHex(e),
              a.parent || t.scene.add(a);
          };
        },
        s = l;
    },
  },
]);
